/**
 * Created by Administrator on 2017/7/1.
 */
!(function(win, doc){
    function setFontSize() {
        // 获取ȡwindow 宽度
        var winWidth =  window.innerWidth;

        var size = Math.floor((winWidth / 750) * 16);
        doc.documentElement.style.fontSize = (size < 16 ? size : 16) + 'px' ;
    }

    var evt = 'onorientationchange' in win ? 'orientationchange' : 'resize';

    var timer = null;

    win.addEventListener(evt, function () {
        clearTimeout(timer);

        timer = setTimeout(setFontSize, 300);
    }, false);

    win.addEventListener("pageshow", function(e) {
        if (e.persisted) {
            clearTimeout(timer);

            timer = setTimeout(setFontSize, 300);
        }
    }, false);

    // 设置字体大小
    setFontSize();

}(window, document));


(function(){
    var showPop  = document.getElementById("showPop");

    var popClose = document.getElementById("popClose");

    var popOver  = document.getElementById("popOver");

    var moreBtn  = document.getElementById("moreBtn");

    var loveListLists = document.getElementById("loveListLists");

    var loveListBg    = document.getElementById("loveListBg");

    var bgHtml      = "";

    var contentHtml = "";

    var num         = 17;

    function myRender(){
        for(var i=0;i<4;i++){
            contentHtml += "<li class='love-list-item after'>";
            contentHtml +=     "<img src='image/16_wx_15.jpg' />";
            contentHtml +=     "<span>";
            contentHtml +=         "<span>xiaoyaobad送出了祝福：</span>你们一定要幸福哦！";
            contentHtml +=     "</span>";
            contentHtml += "</li>";
        }
        loveListLists.innerHTML += contentHtml;

        for(var j=0;j<num;j++){
            bgHtml      += "<img src='image/16_wx_18.png'/>";
        }
        loveListBg.innerHTML    += bgHtml;
    }

    function init(){
       myRender();
    }
    init();

    showPop.addEventListener('click',function(){
        popOver.style.display = "block";
    });

    popClose.addEventListener('click',function(){
        popOver.style.display = "none";
    });

    moreBtn.addEventListener('click',function(){
        num++;
        myRender();
    })
})();